Component({
  properties: {
    parent: {
      type: Object,
      value: {},
    },
  },
  data: {
    isShow: false,
    isAutoPlay: false, // ====> 初始化自动播放的条件，只作用第一次
  },
  methods: {
    _onSwitch() {
      let isShow = !this.data.isShow;
      let parent = this.data.parent;
      if (parent && parent.config) { parent.config.autoplay = true }
      this.setData({ isShow, isAutoPlay: false, parent });
    },
    screenChange(e){
      let fullScreen = e.detail.fullScreen //值true为进入全屏，false为退出全屏
      this.triggerEvent('screenchange', fullScreen);
    },
    imageload(e) {
      // console.log(e.detail)
      let height = e.detail.height / e.detail.width * 750;
      this.setData({
        imgWidth: e.detail.width,
        imgHeight: height,
      });
    },
  },
  ready() {
    let isAutoPlay = this.data.parent && this.data.parent.config && this.data.parent.config.autoplay;
    this.setData({
      isAutoPlay,
    });
    // console.log('vedio============>',this.data.parent)
  },
});
